package com.shaw.client.model.ui;

import com.extjs.gxt.ui.client.Style.LayoutRegion;
import com.extjs.gxt.ui.client.util.Margins;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.HtmlContainer;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.Viewport;
import com.extjs.gxt.ui.client.widget.layout.AccordionLayout;
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;


public class AppMainUI extends  Viewport {

	
	  private ContentPanel west;
	  private LayoutContainer center;
	  
		   public AppMainUI() {
		    setLayout(new BorderLayout());
		 	createCenter();
			createNorth();
			createWest();
		   }

		   private  void createNorth() {
			    StringBuffer sb = new StringBuffer();
			    sb.append("<div id='demo-header' class='x-small-editor'><div id='demo-theme'></div><div id=demo-title>程序名称</div></div>");

			    HtmlContainer northPanel = new HtmlContainer(sb.toString());
			    northPanel.setStateful(false);

			    BorderLayoutData data = new BorderLayoutData(LayoutRegion.NORTH, 33);
			    data.setMargins(new Margins());
			    this.add(northPanel, data);
			  }

		   private void createWest() {
			    BorderLayoutData data = new BorderLayoutData(LayoutRegion.WEST, 200, 150, 350);
			    data.setMargins(new Margins(5, 0, 5, 5));

			    west = new ContentPanel();
			    west.setBodyBorder(false);
			    west.setLayout(new AccordionLayout());
			    west.setLayoutOnChange(true);
			    west.setHeading("程序演示");

			    this.add(west, data);
			  }

		   private  void createCenter() {
			    center = new LayoutContainer();
			    center.setLayout(new FitLayout());

			    BorderLayoutData data = new BorderLayoutData(LayoutRegion.CENTER);
			    data.setMargins(new Margins(5, 5, 5, 5));

			    this.add(center, data);
			  }

		public ContentPanel getWest() {
			return west;
		}

		public void setWest(ContentPanel west) {
			this.west = west;
		}

		public LayoutContainer getCenter() {
			return center;
		}

		public void setCenter(LayoutContainer center) {
			this.center = center;
		}




}